package com.cskaoyan.order.api;

import com.cskaoyan.mall.commons.result.ServiceCallResponse;
import com.cskaoyan.order.constant.OrderRetCode;
import com.cskaoyan.order.service.PayOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author gatsby
 * @since 2022/10/30 16:19
 */
public class PayOrderApiImpl {

    @Autowired
    PayOrderService payOrderService;





    /**
     *  支付成功时，更新订单状态，更新锁定库存，更新订单商品库存状态
     * @return
     */
    @PutMapping(value = "/rpc/pay/success")
    ServiceCallResponse<Object> payOrderSuccess(@RequestParam("orderId") String orderId){
        //更新订单状态
        payOrderService.payOrderSuccess(orderId);
        return new ServiceCallResponse<>(OrderRetCode.SUCCESS.getCode(),OrderRetCode.SUCCESS.getMessage(),null);
    }
}
